<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
//         1.
        var str1 = 'str';
        str1 += 2;
        var obj = typeof str1;  //obj = string
        if (typeof obj == 'string') {
            var obj = new String()
            obj.sign = 'Live'
        }
        console.log(obj.sign);

// 2.
// 算出字符串的所占用字节的长度， 如: str  ='live' 长度为4      str='live生活'   长度为8 （提示:unicode<=255的占1字节，unicode>255的占用2字节, str.charCodeAt(i)查看i的字节码）
var str='live生活';
var num=0;
const dada=str.split('');
dada.forEach(element => {
    str.charCodeAt(str.indexOf(element))>255? num=num+2 : num++;
});

console.log(num);
// 3.要求输入一串低于10位的数字，输出对应的中文大写:
var tree=12345678;

tree=tree.toString()
const lv=['','拾','佰','仟','万','拾','佰','仟','亿','拾','佰'];
const number=['零','壹','贰','叁','肆','伍','陆','柒','捌','玖']


var nn='';
var aa=1;




xuxu.forEach(Element=>{
    
    if(Element=='0'){
        if(nn.indexOf('零')==nn.length-1){
            
            if(aa%4==0){
                nn=nn.substr(0,nn.length-1);
                nn+=lv[xuxu.length - aa];
            }
            
        }else{
        nn+=number[Element];
    }
    }else{
        nn+=(number[Element]+lv[xuxu.length - aa]);    
    }

     
    aa++
})
console.log(nn);
// 例： input: 10001  --> 一万零一     ；   input:  10,000,000  -->  一千万
    </script>
</body>
</html>